import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../resource/ImagesConst";
import { GBox } from "../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { TransportItem } from "./TransportItem";
import { TransportInfo } from "../../model/TransportInfo";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class TransportPanel
    
    export  class TransportPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._items = [];
            mouseEnabled = false;
            mouseChildren = false;
            this.initUI();
            return;
        }

        protected initUI(): void
        {
            var loc2=null;
            this._windowCenterB = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            addChild(this._windowCenterB);
            this._hbox1 = new GBox();
            this._hbox1.direction = GBoxDirection.HORIZONTAL;
            this._hbox1.x = -20;
            addChild(this._hbox1);
            this._hbox2 = new GBox();
            this._hbox2.direction = GBoxDirection.HORIZONTAL;
            this._hbox2.y = 140;
            this._hbox2.x = 90;
            addChild(this._hbox2);
            var loc1=1;
            while (loc1 <= 5) 
            {
                loc2 = new TransportItem(loc1);
                if (loc1 <= 3) 
                {
                    this._hbox1.addChild(loc2);
                }
                else 
                {
                    this._hbox2.addChild(loc2);
                }
                this._items.push(loc2);
                ++loc1;
            }
            this._hbox1.invalidate();
            this._hbox2.invalidate();
            return;
        }

        public updateData(arg1: TransportInfo): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._items;
            for(loc1 of loc3) 
            {
                loc1.updateData(arg1);
                if (loc1.color == arg1.color) 
                {
                    loc1.updateFilter(true);
                    continue;
                }
                loc1.updateFilter(false);
            }
            return;
        }

        public setSize(arg1: int, arg2: int): void
        {
            this._width = arg1;
            this._height = arg2;
            if (this._windowCenterB) 
            {
                this._windowCenterB.setSize(this._width, this._height);
            }
            return;
        }

        public dispose(): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._items;
            for(loc1 of loc3) 
            {
                loc1.dispose();
            }
            return;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        /* internal */ /* var */_height: int;

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_windowCenterB: ScaleBitmap;

        /* internal */ /* var */_hbox1: GBox;

        /* internal */ /* var */_hbox2: GBox;

        /* internal */ /* var */_items: Array<any>;
    }
